package car.util;

import car.bean.Book;

import java.util.HashMap;
import java.util.Map;

public class BooksMapUtil {
    private static Integer num = 0;

    private static Map<Integer, Book> booksMap = new HashMap();

    private BooksMapUtil(){}

    static {
        Book b1 = new Book(++num, "html+css", 10, 100);
        Book b2 = new Book(++num, "javascript", 100, 1000);
        Book b3 = new Book(++num, "javaoo编程", 199, 2000);
        Book b4 = new Book(++num, "数据库编程", 150, 1500);
        Book b5 = new Book(++num, "java基础", 20, 200);

        booksMap.put(b1.getNum(), b1);
        booksMap.put(b2.getNum(), b2);
        booksMap.put(b3.getNum(), b3);
        booksMap.put(b4.getNum(), b4);
        booksMap.put(b5.getNum(), b5);
    }

    public static Integer getNum(){
        return ++num;
    }

    public static String showAll(){
        String s = "";



        return "编号\t书名\t价格\t当前库存\n" + s;
    }
}
